package puzzle.projecteuler.p300;

import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;

import astudy.util.AdvMath;

public class Problem203C {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Set<BigInteger> set = new HashSet<BigInteger>();
		for (int c = 0; c < 51; c ++) {
			for (int k = 0; k < 1+c/2; k ++) {
				if (check(c, k)) {
					set.add(AdvMath.combine(BigInteger.valueOf(c), BigInteger.valueOf(k)));
				}
			}
		}
		System.out.println(set.size());
		
		BigInteger s = BigInteger.ZERO;
		for (BigInteger a: set) {
			s = s.add(a);
		}
		System.out.println(s);
	}

	public static boolean check(int c, int k) {
		
		int[] ps = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
		for (int i = 0; i < ps.length; i ++) {
			int p = ps[i];
			int a = pow(c, p);
			int x = pow(k, p);
			int y = pow(c-k, p);
			if (a-x-y >= 2) {
				return false;
			}
		}
		return true;
	}
	
	public static int pow(int n, int p) {
		
		int s = 0;
		int t = n;
		while (t > 0) {
			t = t/p;
			s += t;
		}
		return s;
	}
}
